// pages/spike/spike.js
var app = getApp();
var $ = app.globalData;
Page({

  /**
   * 页面的初始数据
   */
  data: {
	name:"",
	page:1
  },

  /**
   * 生命周期函数--监听页面加载
   */
  onLoad: function (options) {
	  var that = this
	wx.request({
		url:$.AdminUrl+"/YApi/getGoodsList",
			data:{
				shoptype:5,
				name:that.data.name,
				onetypeid:-1,
				twotypeid:-1,
				page:that.data.page
			},
			success:function(data){
				console.log(data)
				that.setData({
					loadmore:data.data.obj.length>10?true:false,
					goodslist:data.data.obj
				})
			}
	})
  },
  onShow: function () {

  },
  pingtaigoods:function(data){
  	  var thisid = data.currentTarget.dataset.id
  	  wx.navigateTo({
  	  	url:"/pages/shopping/details/details?id="+thisid+"&goodslib=0"
  	  })
  },

  /**
   * 生命周期函数--监听页面隐藏
   */
  onHide: function () {

  },

  /**
   * 生命周期函数--监听页面卸载
   */
  onUnload: function () {

  },

  /**
   * 页面相关事件处理函数--监听用户下拉动作
   */
  onPullDownRefresh: function () {

  },

  /**
   * 页面上拉触底事件的处理函数
   */
  onReachBottom: function () {

  },
// 分享转发
		onShareAppMessage: function() {
			var userinfo = wx.getStorageSync('userinfo')
			return {
				title: '优悦购生活管家',
				path: '/pages/index/index?userid='+userinfo.loginname,
				success: (res) => {
					console.log("转发成功", res);
				},
				fail: (res) => {
					console.log("转发失败", res);
				}
			}
		}
})